<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- 
        1. 需要给<slot></slot>标签添加name属性
        2. 分配的内容加上template标签，v-slot:插槽名称
        v-slot:可以简写成#
       -->
      <h2>具名插槽</h2>
      <child>
        <template v-slot:first><span>123</span></template>
        <template #second><span>456</span></template>
      </child>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;

      const Child = {
        template: `
          <div><slot name="first"></slot> - child组件 - <slot name="second"></slot></div>
        `,
      };

      createApp({
        data() {
          return {};
        },
        components: {
          Child,
        },
      }).mount("#app");
    </script>
  </body>
</html>
